package com.zhiyinlou.apps.utils.sql.content;

import java.sql.Connection;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.alibaba.fastjson.JSONObject;
import com.zhiyinlou.apps.utils.db.DBUtils;


public class QuestionsxDbTest {
	
	public static Logger logger = LogManager.getLogger(QuestionsxDbTest.class);
	
	public static JSONObject select_content(String id){
		
		JSONObject respose=new JSONObject();
		
		Connection con = DBUtils.getConnection("content", "content");
		String sql1 = "select qid from q_question_sx where id='"+id+"'";
		String sql2 = "select body from q_question_sx where id='"+id+"'";
		String sql3 = "select question_type_id from q_question_sx where id='"+id+"'";
		
		String qid=DBUtils.getOneObject(con, sql1).toString();
		Object body=DBUtils.getOneObject(con, sql2);
//		String body=DBUtils.getOneObject(con, sql2).toString();
		String question_type_id=DBUtils.getOneObject(con, sql3).toString();
		
		respose.put("qid", qid);
		respose.put("qbody", body);
		respose.put("qtype", question_type_id);
		
		DBUtils.closeConnection("content");
		
		return respose;
	}
	

}
